
//
// 120515 - AHA - Created.
//

package org.socratons.service;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * <p>
 *   Server side parser for
 *   Socratons service XML.
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC)
 */
public final class SocratonsXmlProtocolParser
{
  private SocratonsXmlProtocolParser(){}
  
  /**
   * <p>
   *   Parse.
   * </p>
   * @param t String to parse.
   * @return Parse result.
   * @throws IOException If failed to read or parse.
   */
  public static List<SocData> parse(String t) throws IOException
  {
    if (t==null)
    {
      throw new NullPointerException("t");
    }
    
    ByteArrayInputStream bais=new ByteArrayInputStream(t.getBytes());
    return parse(bais);
  }
  
  /**
   * <p>
   *   Parse.
   * </p>
   * @param F {@link File} to parse.
   * @return Parse result.
   * @throws IOException If failed to read or parse.
   */
  public static List<SocData> parse(File f) throws IOException
  {
    if (f==null)
    {
      throw new NullPointerException("f");
    }
    
    InputStream is=null;
    try
    {
      is=new FileInputStream(f);
      return parse(is);
    }
    finally
    {
      if (is!=null) try { is.close(); } catch (IOException _){}
    }
  }
  
  /**
   * <p>
   *   Parse.
   * </p>
   * @param is Stream to parse.
   * @return Parse result.
   * @throws IOException If failed to read or parse.
   */
  public static List<SocData> parse(InputStream is) throws IOException
  {
    return null;
  }
  
  
}
